package com.heima.admin.controller.v1;


import com.heima.admin.service.AdNewsService;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author yht
 * @date 2022/1/13 14:46
 */
@RestController
@RequestMapping("/api/v1/news")
public class AdNewsControlle {

    @Autowired
    private AdNewsService adNewsService;
    /**
     * 查询自动审核文章的列表
     * @return
     */
    @PostMapping("/list_vo")
    public PageResponseResult findAutoAuditLose(@RequestBody NewsAuthDto newsAuthDto){
        return adNewsService.findAutoAuditLose(newsAuthDto);
    }

    /**
     * 根据id查询审核的文章
     */
    @GetMapping("/one_vo/{id}")
    public ResponseResult findNewById(@PathVariable("id") Integer id){
        return adNewsService.findNewById(id);
    }

    /**
     * 文章审核驳回
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto newsAuthDto){
        return adNewsService.authFail(newsAuthDto);
    }
    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto newsAuthDto){
        return adNewsService.authPass(newsAuthDto);
    }
}
